const fs = require('fs')

// 日志
function writeFileerror(err){
    let log = fs.readFileSync('./logs/api.log', 'utf-8')
    log = log.replace(/ok$/, err)
    fs.writeFile('./logs/api.log', log, () => {})   
}
function resinfo(res,errorCode,message,data=null){
    res.json({
        errorCode,
        message,
        data
    })
}
module.exports ={
    writeFileerror,resinfo
}